package com.qf.lanzhou.shop.api.controller;

import com.qf.lanzhou.shop.api.service.SearchService;
import com.qf.lanzhou.shop.pojo.entity.Goods;
import com.qf.lanzhou.shop.pojo.entity.ShopCart;
import com.qf.lanzhou.shop.pojo.vo.BaseRespVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

/**
 * @author 是柠檬甜
 * @date 2021/1/12 10:21
 */
@Controller
public class SearchController extends BaseController{
    @Autowired
    private SearchService searchService;

    @ApiOperation("搜索商品")
    @RequestMapping("/searchGoods")
    @ResponseBody
    public BaseRespVO searchGoods(String searchResult) {
        HashSet<Goods> search = searchService.search(searchResult);
        System.out.println(searchResult);
        return convertSuccessResult(search);
    }
}
